//
//  DataSet.h
//  iMed

// This is the container for all the data sets maintained by the application
// It's the object that's read from / written to files.

//
//  Created by Barry Press on 10/19/09.
//  Copyright 2009 Barry Press. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "Meds.h"
#import "RXlog.h"
#import "ForecastSchedule.h"
#import "HistoryLog.h"

// Note that the below does not work when control switches away from this app
#define CURRENTDATASET [[[NSDocumentController sharedDocumentController] currentDocument] dataset]


@interface DataSet : NSObject <NSCoding> {
	Meds *arrayMeds;
	RXlog *arrayRXlog;
	ForecastSchedule *forecast;
	HistoryLog *history;
	NSCalendar* calendar;
}

- (NSTimeInterval) averageIntervalForRX:(RX*)anRx;
- (NSTimeInterval) averageIntervalForRX:(RX*)anRx returnsCount:(int*)iCount returnsHistory:(History**)anH;
- (NSArray*)getReadyRXArray;
- (BOOL)isDate:(NSDate*)d1 onSameDayAsDate:(NSDate*)d2;


- (History*)createHistoryWithRX:(RX*)anRX atTime:aTime;
- (NDCitem*)createNDC;
- (RX*)createRXForNDC:(NDCitem*)anNDC writtenOnDate:(NSDate*)wDate filledOnDate:(NSDate*)fDate;

/*
- (void)printMeds;
- (void)printRXlog;
- (void)printarray:(NSArray*)array;
*/

@property (readwrite, retain) Meds* arrayMeds;
@property (readwrite, retain) RXlog* arrayRXlog;
@property (readwrite, retain) ForecastSchedule* forecast;
@property (readwrite, retain) HistoryLog* history;

@end
